<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MVCWeb.Models.ViewData.DocumentNewViewData>" %>
<%@ Register Src="~/Views/Menu/MainMenu.ascx" TagName="MainMenu" TagPrefix="mmuc" %>

<%@ Register Src="~/Views/Shared/LogOnUserControl.ascx" TagName="LogOnUserControl" TagPrefix="louc" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
	<title>Admin: Create Legislative Updates</title>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <script type="text/javascript">
        $(document).ready(function() {
            $("#DocumentForm").validate({
                rules: {
                    Name: {
                        required: true
                    },
                    FullPath: {
                        required: true
                    }

                },
                messages: {
                    Name: {
                        required: "Name must be entered"
                    },
                    FullPath: {
                    required: "File must be entered"
                    }
                }
            });
            $("#submit_view").click(function() {
                $("#IsRedirectToView").val("true");
            });
        });
    </script>

<louc:LogOnUserControl ID="LogOnUserControl1" runat="server" />
    <!-- BEGIN: MainMenu -->
    <mmuc:MainMenu ID="MainMenu1" runat="server" />
    <!-- END: MainMenu -->
<br />
<br />
    <%= Html.ValidationSummary() %>
    <% using (Html.BeginForm("CreateLegislativeDoc", "Doc", FormMethod.Post, new { id = "DocumentForm", enctype = "multipart/form-data" }))
       {%>
    <fieldset>
        <legend>Admin: Create Legislative Updates</legend>
        <p>
            <label for="Name">
                Document Name:</label>
            <%= Html.TextBox("Name", ViewData.Model.Document.Name)%>
            <%= Html.ValidationMessage("Name", "*") %>
        </p>
        <p>
            <label for="Desc">
                Description:</label>
            <%= Html.TextArea("Desc", ViewData.Model.Document.Desc) %>
            <%= Html.ValidationMessage("Desc", "*") %>
        </p>
        <p>
            <label for="FullPath">
                Filename:</label>
            <input type="file" name="FullPath" id="FullPath" size="34" />
            <%= Html.ValidationMessage("FullPath", "*") %>
        </p>
        <p>
            <label for="UserId">
                Category:</label>
            <%= Html.DropDownList("CategoryId", new SelectList(ViewData.Model.Categories, "DocCategoryId", "Category", "1"), new { disabled = "disabled" })%>
            <%= Html.ValidationMessage("UserId", "*")%>
        </p>
        <br />
        <p>
            <%= Html.Hidden("IsRedirectToView")%>
            <input id="submit" name="submit" type="submit" value="Save & New" />
            <input id="submit_view" name="submit_view" type="submit" value="Save & View" />            
            <input type="reset" value="Reset" />
        </p>
    </fieldset>
    <% } %>
    <div>
        <%=Html.ActionLink("Go back", "IndexOfLegislative")%>
    </div>
</asp:Content>

